<!DOCTYPE html>
<html lang="en-us">
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    
<meta charset="UTF-8">
<title>Java time migration guide | Elasticsearch Guide [7.7] | Elastic</title>
<link rel="home" href="index.html" title="Elasticsearch Guide [7.7]">
<link rel="up" href="breaking-changes-7.0.html" title="Breaking changes in 7.0">
<link rel="prev" href="breaking-changes-7.0.html" title="Breaking changes in 7.0">
<link rel="next" href="es-release-notes.html" title="Release notes">
<meta name="DC.type" content="Learn/Docs/Elasticsearch/Reference/7.7">
<meta name="DC.subject" content="Elasticsearch">
<meta name="DC.identifier" content="7.7">
<meta name="robots" content="noindex,nofollow">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script src="https://cdn.optimizely.com/js/18132920325.js"></script>
    <link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/apple-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/apple-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/apple-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/apple-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/apple-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="/apple-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180x180.png">
    <link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32">
    <link rel="icon" type="image/png" href="/android-chrome-192x192.png" sizes="192x192">
    <link rel="icon" type="image/png" href="/favicon-96x96.png" sizes="96x96">
    <link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16">
    <link rel="manifest" href="/manifest.json">
    <meta name="apple-mobile-web-app-title" content="Elastic">
    <meta name="application-name" content="Elastic">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="/mstile-144x144.png">
    <meta name="theme-color" content="#ffffff">
    <meta name="naver-site-verification" content="936882c1853b701b3cef3721758d80535413dbfd">
    <meta name="yandex-verification" content="d8a47e95d0972434">
    <meta name="localized" content="true">
    <meta name="st:robots" content="follow,index">
    <meta property="og:image" content="https://www.elastic.co/static/images/elastic-logo-200.png">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" href="/favicon.ico" type="image/x-icon">
    <link rel="apple-touch-icon-precomposed" sizes="64x64" href="/favicon_64x64_16bit.png">
    <link rel="apple-touch-icon-precomposed" sizes="32x32" href="/favicon_32x32.png">
    <link rel="apple-touch-icon-precomposed" sizes="16x16" href="/favicon_16x16.png">
    <!-- Give IE8 a fighting chance -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/guide/static/styles.css">
  </head>

  <!--© 2015-2021 Elasticsearch B.V. Copying, publishing and/or distributing without written permission is strictly prohibited.-->

  <body>
    <!-- Google Tag Manager -->
    <script>dataLayer = [];</script><noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-58RLH5" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
    <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-58RLH5');</script>
    <!-- End Google Tag Manager -->

    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-12395217-16"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', 'UA-12395217-16');
    </script>

    <!--BEGIN QUALTRICS WEBSITE FEEDBACK SNIPPET-->
    <script type="text/javascript">
      (function(){var g=function(e,h,f,g){
      this.get=function(a){for(var a=a+"=",c=document.cookie.split(";"),b=0,e=c.length;b<e;b++){for(var d=c[b];" "==d.charAt(0);)d=d.substring(1,d.length);if(0==d.indexOf(a))return d.substring(a.length,d.length)}return null};
      this.set=function(a,c){var b="",b=new Date;b.setTime(b.getTime()+6048E5);b="; expires="+b.toGMTString();document.cookie=a+"="+c+b+"; path=/; "};
      this.check=function(){var a=this.get(f);if(a)a=a.split(":");else if(100!=e)"v"==h&&(e=Math.random()>=e/100?0:100),a=[h,e,0],this.set(f,a.join(":"));else return!0;var c=a[1];if(100==c)return!0;switch(a[0]){case "v":return!1;case "r":return c=a[2]%Math.floor(100/c),a[2]++,this.set(f,a.join(":")),!c}return!0};
      this.go=function(){if(this.check()){var a=document.createElement("script");a.type="text/javascript";a.src=g;document.body&&document.body.appendChild(a)}};
      this.start=function(){var a=this;window.addEventListener?window.addEventListener("load",function(){a.go()},!1):window.attachEvent&&window.attachEvent("onload",function(){a.go()})}};
      try{(new g(100,"r","QSI_S_ZN_emkP0oSe9Qrn7kF","https://znemkp0ose9qrn7kf-elastic.siteintercept.qualtrics.com/WRSiteInterceptEngine/?Q_ZID=ZN_emkP0oSe9Qrn7kF")).start()}catch(i){}})();
    </script><div id="ZN_emkP0oSe9Qrn7kF"><!--DO NOT REMOVE-CONTENTS PLACED HERE--></div>
    <!--END WEBSITE FEEDBACK SNIPPET-->

    <div id="elastic-nav" style="display:none;"></div>
    <script src="https://www.elastic.co/elastic-nav.js"></script>

    <!-- Subnav -->
    <div>
      <div>
        <div class="tertiary-nav d-none d-md-block">
          <div class="container">
            <div class="p-t-b-15 d-flex justify-content-between nav-container">
              <div class="breadcrum-wrapper"><span><a href="/guide/" style="font-size: 14px; font-weight: 600; color: #000;">Docs</a></span></div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <div class="main-container">
      <section id="content">
        <div class="content-wrapper">

          <section id="guide" lang="en">
            <div class="container">
              <div class="row">
                <div class="col-xs-12 col-sm-8 col-md-8 guide-section">
                  <!-- start body -->
                  <div class="page_header">
<strong>IMPORTANT</strong>: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
<a href="../current/index.html">current release documentation</a>.
</div>
<div id="content">
<div class="breadcrumbs">
<span class="breadcrumb-link"><a href="index.html">Elasticsearch Guide [7.7]</a></span>
»
<span class="breadcrumb-link"><a href="breaking-changes.html">Breaking changes</a></span>
»
<span class="breadcrumb-link"><a href="breaking-changes-7.0.html">Breaking changes in 7.0</a></span>
»
<span class="breadcrumb-node">Java time migration guide</span>
</div>
<div class="navheader">
<span class="prev">
<a href="breaking-changes-7.0.html">« Breaking changes in 7.0</a>
</span>
<span class="next">
<a href="es-release-notes.html">Release notes »</a>
</span>
</div>
<div class="section">
<div class="titlepage"><div><div>
<h2 class="title">
<a id="migrate-to-java-time"></a>Java time migration guide<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/migration/migrate_7_0/migrate_to_java_time.asciidoc">edit</a>
</h2>
</div></div></div>
<p>With 7.0, Elasticsearch switched from joda time to java time for date-related parsing,
formatting, and calculations. This guide is designed to help you determine
if your cluster is impacted and, if so, prepare for the upgrade.</p>
<h3>
<a id="java-time-convert-date-formats"></a>Convert date formats<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/migration/migrate_7_0/migrate_to_java_time.asciidoc">edit</a>
</h3>
<p>To upgrade to 7.0, you’ll need to convert any joda-time date formats
to their java-time equivalents.</p>
<p>To help track this effort, you can prefix java-time date formats with an <code class="literal">8</code>
 in Elasticsearch 6.8 and later versions.</p>
<p>For example, you can change the date format <code class="literal">YYYY-MM-dd</code> to <code class="literal">8yyyy-MM-dd</code> to
indicate the date format uses java time.</p>
<p>Elasticsearch treats date formats starting with the <code class="literal">8</code> prefix differently depending on
the version:</p>
<p><span class="strong strong"><strong>6.8</strong></span>: Date formats with an <code class="literal">8</code> prefix are handled as java-time formats. Date
formats without an <code class="literal">8</code> prefix are treated as joda-time formats. We recommend
converting these joda-time formats to java-time <em>before</em> upgrading to 7.x.</p>
<p><span class="strong strong"><strong>7.x and later</strong></span>: For indices created in 6.x, date formats without an <code class="literal">8</code> prefix
are treated as joda-time formats. For indices created in 7.x and later versions,
all date formats are treated as java-time formats, regardless of whether it
starts with an <code class="literal">8</code> prefix.</p>
<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="java-time-migration-impacted-features"></a>Impacted features<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/migration/migrate_7_0/migrate_to_java_time.asciidoc">edit</a>
</h3>
</div></div></div>
<p>The switch to java time only impacts custom <a class="xref" href="date.html" title="Date datatype"><code class="literal">date</code></a> and
<a class="xref" href="date_nanos.html" title="Date nanoseconds datatype"><code class="literal">date_nanos</code></a> formats.</p>
<p>These formats are commonly used in:</p>
<div class="ulist itemizedlist">
<ul class="itemizedlist">
<li class="listitem">
<a class="xref" href="mapping.html" title="Mapping">Index mappings</a>
</li>
<li class="listitem">
<a class="xref" href="indices-templates.html" title="Put index template API">Index templates</a>
</li>
<li class="listitem">
<a class="xref" href="pipeline.html" title="Pipeline Definition">Ingest pipelines</a>
</li>
</ul>
</div>
<p>If you don’t use custom date formats, you can skip the rest of this guide.
Most custom date formats are compatible. However, several require
an update.</p>
<p>To see if your date format is impacted, use the <a class="xref" href="migration-api-deprecation.html" title="Deprecation info APIs">deprecation info API</a>
or the <a href="/guide/en/kibana/7.7/upgrade-assistant.html" class="ulink" target="_top">Kibana upgrade assistant</a>.</p>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="java-time-migration-incompatible-date-formats"></a>Incompatible date formats<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/migration/migrate_7_0/migrate_to_java_time.asciidoc">edit</a>
</h3>
</div></div></div>
<p>Custom date formats containing the following joda-time literals should be
changed before upgrading.</p>
<div class="variablelist">
<dl class="variablelist">
<dt>
<span class="term">
<code class="literal">Y</code> (Year of era)
</span>
</dt>
<dd>
<p>Replace with <code class="literal">y</code>.</p>
<p><span class="strong strong"><strong>Example:</strong></span>
<code class="literal">YYYY-MM-dd</code> should become <code class="literal">yyyy-MM-dd</code>.</p>
<p>In java time, <code class="literal">Y</code> is used for
<a href="https://docs.oracle.com/javase/8/docs/api/java/time/temporal/WeekFields.html" class="ulink" target="_top">week-based year</a>.
Using <code class="literal">Y</code> in place of <code class="literal">y</code> could result in off-by-one errors in year calculation.</p>
<p>For pattern <code class="literal">YYYY-ww</code> and date <code class="literal">2019-01-01T00:00:00.000Z</code>  will give <code class="literal">2019-01</code>
For pattern <code class="literal">YYYY-ww</code> and date <code class="literal">2018-12-31T00:00:00.000Z</code>  will give <code class="literal">2019-01</code> (counter-intuitive) because there is &gt;4 days of that week in 2019</p>
</dd>
<dt>
<span class="term">
<code class="literal">y</code> (Year)
</span>
</dt>
<dd>
<p>Replace with <code class="literal">u</code>.</p>
<p><span class="strong strong"><strong>Example:</strong></span>
<code class="literal">yyyy-MM-dd</code> should become <code class="literal">uuuu-MM-dd</code>.</p>
<p>In java time, <code class="literal">y</code> is used for year of era. <code class="literal">u</code> can contain non-positive
values while <code class="literal">y</code> cannot. <code class="literal">y</code> can also be associated with an era field.</p>
</dd>
<dt>
<span class="term">
<code class="literal">C</code> (Century of era)
</span>
</dt>
<dd>
<p>Century of era is not supported in java time.
There is no replacement. Instead, we recommend you preprocess your input.</p>
</dd>
<dt>
<span class="term">
<code class="literal">x</code> (Week year)
</span>
</dt>
<dd>
<p>Replace with <code class="literal">Y</code>.</p>
<p>In java time, <code class="literal">x</code> means <a href="https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html" class="ulink" target="_top">zone-offset</a>.</p>
<div class="warning admon">
<div class="icon"></div>
<div class="admon_content">
<p>Failure to properly convert <code class="literal">x</code> (Week year) to <code class="literal">Y</code> could result in data loss.</p>
</div>
</div>
</dd>
<dt>
<span class="term">
<code class="literal">Z</code> (Zone offset/id)
</span>
</dt>
<dd>
<p>Replace with multiple <code class="literal">X</code>'s.</p>
<p><code class="literal">Z</code> has a similar meaning in java time. However, java time expects different
numbers of literals to parse different forms.</p>
<p>Consider migrating to <code class="literal">X</code>, which gives you more control over how time is parsed.
For example, the joda-time format <code class="literal">YYYY-MM-dd'T'hh:mm:ssZZ</code> accepts the following dates:</p>
<pre class="screen">2010-01-01T01:02:03Z
2010-01-01T01:02:03+01
2010-01-01T01:02:03+01:02
2010-01-01T01:02:03+01:02:03</pre>
<p>In java time, you cannot parse all these dates using a single format
Instead, you must specify 3 separate formats:</p>
<pre class="screen">2010-01-01T01:02:03Z
2010-01-01T01:02:03+01
both parsed with yyyy-MM-dd'T'hh:mm:ssX

2010-01-01T01:02:03+01:02
yyyy-MM-dd'T'hh:mm:ssXXX

2010-01-01T01:02:03+01:02:03
yyyy-MM-dd'T'hh:mm:ssXXXXX</pre>
<p>The formats must then be delimited using <code class="literal">||</code>:</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">yyyy-MM-dd'T'hh:mm:ssX||yyyy-MM-dd'T'hh:mm:ssXXX||yyyy-MM-dd'T'hh:mm:ssXXXXX</pre>
</div>
<p>The same applies if you expect your pattern to occur without a colon (<code class="literal">:</code>):
For example, the <code class="literal">YYYY-MM-dd'T'hh:mm:ssZ</code> format accepts the following date forms:</p>
<pre class="screen">2010-01-01T01:02:03Z
2010-01-01T01:02:03+01
2010-01-01T01:02:03+0102
2010-01-01T01:02:03+010203</pre>
<p>To accept all these forms in java time, you must use the <code class="literal">||</code> delimiter:</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">yyyy-MM-dd'T'hh:mm:ssX||yyyy-MM-dd'T'hh:mm:ssXX||yyyy-MM-dd'T'hh:mm:ssXXXX</pre>
</div>
</dd>
<dt>
<span class="term">
<code class="literal">d</code> (Day)
</span>
</dt>
<dd>
<p>In java time, <code class="literal">d</code> is still interpreted as "day" but is less flexible.</p>
<p>For example, the joda-time date format <code class="literal">YYYY-MM-dd</code> accepts <code class="literal">2010-01-01</code> or
<code class="literal">2010-01-1</code>.</p>
<p>In java time, you must use the <code class="literal">||</code> delimiter to provide specify each format:</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">yyyy-MM-dd||yyyy-MM-d</pre>
</div>
<p>In java time, <code class="literal">d</code> also does not accept more than 2 digits. To accept days with more
than two digits, you must include a text literal in your java-time date format.
For example, to parse <code class="literal">2010-01-00001</code>, you must use the following java-time date format:</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">yyyy-MM-'000'dd</pre>
</div>
</dd>
<dt>
<span class="term">
<code class="literal">e</code> (Name of day)
</span>
</dt>
<dd>
<p>In java time, <code class="literal">e</code> is still interpreted as "name of day" but does not parse
short- or full-text forms.</p>
<p>For example, the joda-time date format <code class="literal">EEE YYYY-MM</code> accepts both
<code class="literal">Wed 2020-01</code> and <code class="literal">Wednesday 2020-01</code>.</p>
<p>To accept both of these dates in java time, you must specify each format using
the <code class="literal">||</code> delimiter:</p>
<div class="pre_wrapper lang-txt">
<pre class="programlisting prettyprint lang-txt">cccc yyyy-MM||ccc yyyy-MM</pre>
</div>
<p>The joda-time literal <code class="literal">E</code> is interpreted as "day of week."
The java-time literal <code class="literal">c</code> is interpreted as "localized day of week."
<code class="literal">E</code> does not accept full-text day formats, such as <code class="literal">Wednesday</code>.</p>
</dd>
<dt>
<span class="term">
<code class="literal">EEEE</code> and similar text forms
</span>
</dt>
<dd>
<p>Support for full-text forms depends on the locale data provided with your Java
Development Kit (JDK) and other implementation details. We recommend you
test formats containing these patterns carefully before upgrading.</p>
</dd>
<dt>
<span class="term">
<code class="literal">z</code> (Time zone text)
</span>
</dt>
<dd>
<p>In java time, <code class="literal">z</code> outputs <em>Z</em> for Zulu when given a UTC timezone.</p>
</dd>
</dl>
</div>
<div class="section">
<div class="titlepage"><div><div>
<h4 class="title">
<a id="java-time-migration-test"></a>Test with your data<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/migration/migrate_7_0/migrate_to_java_time.asciidoc">edit</a>
</h4>
</div></div></div>
<p>We strongly recommend you test any date format changes using real data before
deploying in production.</p>
<p>For help with date debugging, consider using
<a href="https://esddd.herokuapp.com/" class="ulink" target="_top">https://esddd.herokuapp.com/.</a></p>
</div>

</div>

<div class="section">
<div class="titlepage"><div><div>
<h3 class="title">
<a id="java-time-migrate-update-mappings"></a>Update index mappings<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/migration/migrate_7_0/migrate_to_java_time.asciidoc">edit</a>
</h3>
</div></div></div>
<p>To update joda-time date formats in index mappings, you must create a new index
with an updated mapping and reindex your data to it.
You can however update your pipelines or templates.</p>
<p>The following <code class="literal">my_index_1</code> index contains a mapping for the <code class="literal">datetime</code> field, a
<code class="literal">date</code> field with a custom joda-time date format.</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">GET my_index_1/_mapping</pre>
</div>
<div class="console_widget" data-snippet="snippets/2189.console"></div>
<div class="pre_wrapper lang-console-result">
<pre class="programlisting prettyprint lang-console-result">{
  "my_index_1" : {
    "mappings" : {
      "properties" : {
         "datetime": {
           "type": "date",
           "format": "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch_millis"
         }
      }
    }
  }
}</pre>
</div>
<p>To change the date format for the <code class="literal">datetime</code> field, create a separate index
containing an updated mapping and date format.</p>
<p>For example, the following <code class="literal">my_index_2</code> index changes the <code class="literal">datetime</code> field’s
date format to <code class="literal">8uuuu/MM/dd HH:mm:ss||uuuu/MM/dd||epoch_millis</code>. The <code class="literal">8</code> prefix
indicates this date format uses java time.</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">PUT my_index_2
{
  "mappings": {
    "properties": {
      "datetime": {
        "type": "date",
        "format": "8uuuu/MM/dd HH:mm:ss||uuuu/MM/dd||epoch_millis"
      }
    }
  }
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/2190.console"></div>
<p>Next, reindex data from the old index to the new index.</p>
<p>The following <a class="xref" href="docs-reindex.html" title="Reindex API">reindex</a> API request reindexes data from
<code class="literal">my_index_1</code> to <code class="literal">my_index_2</code>.</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">POST _reindex
{
  "source": {
    "index": "my_index_1"
  },
  "dest": {
    "index": "my_index_2"
  }
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/2191.console"></div>
<p>If you use index aliases, update them to point to the new index.</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">POST /_aliases
{
    "actions" : [
        { "remove" : { "index" : "my_index_1", "alias" : "my_index" } },
        { "add" : { "index" : "my_index_2", "alias" : "my_index" } }
    ]
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/2192.console"></div>
<div class="section">
<div class="titlepage"><div><div>
<h4 class="title">
<a id="java-time-migration-update-ingest-pipelines"></a>Update ingest pipelines<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/migration/migrate_7_0/migrate_to_java_time.asciidoc">edit</a>
</h4>
</div></div></div>
<p>If your ingest pipelines contain joda-time date formats, you can update them
using the <a class="xref" href="put-pipeline-api.html" title="Put pipeline API">put ingest pipeline</a> API.</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">PUT _ingest/pipeline/my_pipeline
{
  "description": "Pipeline for routing data to specific index",
  "processors": [
    {
      "date": {
        "field": "createdTime",
        "formats": [
         "8uuuu-w"
        ]
      },
      "date_index_name": {
        "field": "@timestamp",
        "date_rounding": "d",
        "index_name_prefix": "x-",
        "index_name_format": "8uuuu-w"
      }
    }
  ]
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/2193.console"></div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h4 class="title">
<a id="java-time-migration-update-index-templates"></a>Update index templates<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/migration/migrate_7_0/migrate_to_java_time.asciidoc">edit</a>
</h4>
</div></div></div>
<p>If your index templates contain joda-time date formats, you can update them
using the <a class="xref" href="indices-templates.html" title="Put index template API">put index template</a> API.</p>
<div class="pre_wrapper lang-console">
<pre class="programlisting prettyprint lang-console">PUT _template/template_1
{
  "index_patterns": [
    "te*",
    "bar*"
  ],
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "_source": {
      "enabled": false
    },
    "properties": {
      "host_name": {
        "type": "keyword"
      },
      "created_at": {
        "type": "date",
        "format": "8EEE MMM dd HH:mm:ss Z yyyy"
      }
    }
  }
}</pre>
</div>
<div class="console_widget" data-snippet="snippets/2194.console"></div>
</div>

<div class="section">
<div class="titlepage"><div><div>
<h4 class="title">
<a id="java-time-migration-update-external-tools-templates"></a>Update external tools and templates<a class="edit_me edit_me_private" rel="nofollow" title="Editing on GitHub is available to Elastic" href="https://github.com/elastic/elasticsearch/edit/7.7/docs/reference/migration/migrate_7_0/migrate_to_java_time.asciidoc">edit</a>
</h4>
</div></div></div>
<p>Ensure you also update any date formats in templates or tools outside of Elasticsearch.
This can include tools such as <a href="/guide/en/beats/libbeat/7.7/getting-started.html" class="ulink" target="_top">Beats</a> or
<a href="/guide/en/logstash/7.7/index.html" class="ulink" target="_top">Logstash</a>.</p>
</div>

</div>

</div>
<div class="navfooter">
<span class="prev">
<a href="breaking-changes-7.0.html">« Breaking changes in 7.0</a>
</span>
<span class="next">
<a href="es-release-notes.html">Release notes »</a>
</span>
</div>
</div>

                  <!-- end body -->
                </div>
                <div class="col-xs-12 col-sm-4 col-md-4" id="right_col">
                  <div id="rtpcontainer" style="display: block;">
                    <div class="mktg-promo">
                      <h3>Most Popular</h3>
                      <ul class="icons">
                        <li class="icon-elasticsearch-white"><a href="https://www.elastic.co/webinars/getting-started-elasticsearch?baymax=default&amp;elektra=docs&amp;storm=top-video">Get Started with Elasticsearch: Video</a></li>
                        <li class="icon-kibana-white"><a href="https://www.elastic.co/webinars/getting-started-kibana?baymax=default&amp;elektra=docs&amp;storm=top-video">Intro to Kibana: Video</a></li>
                        <li class="icon-logstash-white"><a href="https://www.elastic.co/webinars/introduction-elk-stack?baymax=default&amp;elektra=docs&amp;storm=top-video">ELK for Logs &amp; Metrics: Video</a></li>
                      </ul>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </section>

        </div>


<div id="elastic-footer"></div>
<script src="https://www.elastic.co/elastic-footer.js"></script>
<!-- Footer Section end-->

      </section>
    </div>

<script src="/guide/static/jquery.js"></script>
<script type="text/javascript" src="/guide/static/docs.js"></script>
<script type="text/javascript">
  window.initial_state = {}</script>
  </body>
</html>
